<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		
		<pre>
			1.求1+2+...100=和;
			 2.求1-100之间,既是3的倍数又是5的倍数;
			 3.求一下的值
			
			 0+5
			 1+4
			 2+3
			 3+2
			 4+1
			 5+0
			
			 4.求2,-4,6,-8....n,求第n个值是多少?
		</pre>
		 
		 <script type="text/javascript">
		 	//1.求1+2+...100=和;
			/* var a = 0;
			for (var i = 0; i <= 100; i++) {
				// console.log("i:",i)
				a+=i;
			}
				console.log("a:",a) */
			
			
			//2.求1-100之间,既是3的倍数又是5的倍数;
				
			/* for (var i = 0; i < 100; i++) {
			if (i % 3 == 0 && i % 5 == 0) {
				console.log("i:",i);
			   }
			} */
			
			
			
			// 3.求一下的值
			// 0+5
			// 1+4
			// 2+3
			// 3+2
			// 4+1
			// 5+0
			
			/* var a = 0;
			for (var i = 0; i <= 5; i++) {
				a = i + (5 - i);
				console.log("i+", i)
				console.log("a",a)
				console.log(i, "+", (5 - i))
			} */
			
			
			//4.求2,-4,6,-8....n,求第n个值是多少?
			
			/* var n = prompt("请输入数字",)
			for (var i = 1; i < n; i++) {
				if (i % 2 == 0) {
					console.log(i * -2)
				} else{
					console.log(i* 2)
				}
			} */
			
			
		 </script>
		 
	</body>
</html>
